
#include <stdlib.h>
#include <fstream>   
#include <iostream>  

using namespace std; 

int main(void) {  

   ofstream OpenFile("file.txt");   
   if (OpenFile.fail())  
   {  
      cout<<"打开文件错误!"<<endl;   
      exit(0);
   }  
   OpenFile<<"abc def ghi";   
   OpenFile.close();  
   return 0;
}